package com.itheima.oop5;

public class Person
{
	private String name;
	private int age;
	
	public Person(int age)
	{
		this.age=age;
	}

	public Person(String name,int age)
	{
		this.name = name;
		this.age = age;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	/*
        需求：给人定义一个功能，判断是否是同龄人
        */
		public boolean compare(Person p)
		{
			//每一个 成员方法 都自带一个this
			//return this.age == p.getAge();
			return this.age==p.age;
	}
}

class A{
	public boolean compare(Person p,Person p2)
	{
		//每一个 成员方法 都自带一个this
		//return this.age == p.getAge();
		return p.getAge()==p2.getAge();
	}
}